<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller {
	 public function _initialize(){
		
   }
    
	 public function index(){
		
		 if(IS_POST){
			 $username =$_POST["username"];
			 $password =$_POST["password"];
			   $managedao=M('manage');
				 
				  $obj =$managedao->where("username='%s' and password='%s'",array($username,$password))->find();
				  if($obj){
				
					   session("username",$username);
					    session("truename",$obj["truename"]);
					   $this->redirect("Index/tvshow?state=-1"); 
				  }else{
					  
					   $this->success('用户名密码错误');
				  }
			
		 }else{
			   $this->display(); 
		 }
		
     
    }
	

	


}